package com.example.myapplication;

import android.app.Activity;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class ShowContent  extends Activity {
    private TextView mTextview;
    private TextView time;
    private TextView location;
    private MyDB mDb;
    private SQLiteDatabase mSql;
    private TextView hashCode;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//Remove notification bar
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_content);
        mTextview = (TextView)this.findViewById(R.id.showtext);
        time = (TextView)this.findViewById(R.id.showtime);
        location=(TextView)findViewById(R.id.showlocation);
        mDb = new MyDB(this);
        mSql = mDb.getWritableDatabase();
        mTextview.setText(getIntent().getStringExtra(MyDB.CONTENT));
        time.setText(getIntent().getStringExtra(MyDB.TIME));
        location.setText(getIntent().getStringExtra(MyDB.LOCATION));
    }
    public void deleteClick(View v) {
        int id = getIntent().getIntExtra(MyDB.ID,0);
        mSql.delete(MyDB.TABLE_NAME," _id = " + id,null);
        finish();
    }
    public void getCode(View v) {
        String UserNo=LoginWithanim.LoginUserName;
//        int Value = Integer.parseInt(UserNo);
//        Value =2*Value+3;
//        String Result=Integer.toString(Value)+"512";
        hashCode.setText(UserNo);
    }
//    public static String getHashCode(String code) {
//        int Value = Integer.valueOf(code);
//        Value =2*Value+3;
//        String Result=Integer.toString(Value)+"512";
//        return Result;
//    }
//    public static String decodeHashCode(String code){
//        code=code.substring(0,code.length()-3);
////        System.out.println(code);
//        int Value=Integer.valueOf(code);
//        return Integer.toString((Value-3)/2);
//    }
    public void goBackClick(View v) {
        finish();
    }
}
